<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 30] 30.24 java.util.TimeZone (JDK 1.1)</TITLE>
<META NAME="author" CONTENT="David Flanagan">
<META NAME="date" CONTENT="Thu Jul 31 16:35:15 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java">
<META NAME="title" CONTENT="Java in a Nutshell">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java in a Nutshell" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch30_23.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 30<br>The java.util Package</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch30_25.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=sect1>
<h2 CLASS=sect1><A CLASS="TITLE" NAME="JNUT2-CH-30-SECT-24">30.24 java.util.TimeZone (JDK 1.1)</A></h2>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-30-SECT-24.1"></A></h3>
</DIV>

<P CLASS=para>
The <tt CLASS=literal>TimeZone</tt> class represents a time zone; it is
used with the <tt CLASS=literal>Calendar</tt> and <tt CLASS=literal>DateFormat</tt>
classes.

<P CLASS=para>
As an abstract class, <tt CLASS=literal>TimeZone</tt> cannot be directly
instantiated.  Instead, you should call the static
<tt CLASS=literal>getDefault()</tt> method to obtain a <tt CLASS=literal>TimeZone</tt>
object that represents the time zone inherited from the host
operating system.  Or, you should call <tt CLASS=literal>getTimeZone()</tt>
(also static), passing the name of the desired zone.  You
can obtain a list of the supported time zone names by calling
the static <tt CLASS=literal>getAvailableIDs()</tt> method.

<P CLASS=para>
Once you have a <tt CLASS=literal>TimeZone</tt> object, you can call
<tt CLASS=literal>inDaylightTime()</tt> to determine whether, for a given
<tt CLASS=literal>Date</tt>, daylight savings time is in effect for that
time zone.  Call <tt CLASS=literal>getID()</tt> to obtain the name of the
time zone, and call <tt CLASS=literal>getOffset()</tt> for a given date to
determine the number of milliseconds to add to GMT to
convert to the time zone.

<DIV CLASS=screen>
<P>
<PRE>
public abstract class <tt CLASS=literal>TimeZone</tt> extends Object implements Serializable, Cloneable {
    // <tt CLASS=literal>Default Constructor: public TimeZone()</tt>
    // <tt CLASS=literal>Class Methods</tt>
            public static synchronized String[] <tt CLASS=literal>getAvailableIDs</tt>(int <tt CLASS=literal>rawOffset</tt>);
            public static synchronized String[] <tt CLASS=literal>getAvailableIDs</tt>();
            public static synchronized TimeZone <tt CLASS=literal>getDefault</tt>();
            public static synchronized TimeZone <tt CLASS=literal>getTimeZone</tt>(String <tt CLASS=literal>ID</tt>);
            public static synchronized void <tt CLASS=literal>setDefault</tt>(TimeZone <tt CLASS=literal>zone</tt>);
    // <tt CLASS=literal>Public Instance Methods</tt>
            public Object <tt CLASS=literal>clone</tt>();  //<tt CLASS=literal> Overrides Object</tt>
            public String <tt CLASS=literal>getID</tt>();
            public abstract int <tt CLASS=literal>getOffset</tt>(int <tt CLASS=literal>era</tt>, int <tt CLASS=literal>year</tt>, int <tt CLASS=literal>month</tt>, int <tt CLASS=literal>day</tt>, int <tt CLASS=literal>dayOfWeek</tt>, int <tt CLASS=literal>milliseconds</tt>);
            public abstract int <tt CLASS=literal>getRawOffset</tt>();
            public abstract boolean <tt CLASS=literal>inDaylightTime</tt>(Date <tt CLASS=literal>date</tt>);
            public void <tt CLASS=literal>setID</tt>(String <tt CLASS=literal>ID</tt>);
            public abstract void <tt CLASS=literal>setRawOffset</tt>(int <tt CLASS=literal>offsetMillis</tt>);
            public abstract boolean <tt CLASS=literal>useDaylightTime</tt>();
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-30-SECT-24.2">Extended By:</A></h3>

<P CLASS=para>
SimpleTimeZone

</DIV>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-30-SECT-24.3">Passed To:</A></h3>

<P CLASS=para>
Calendar(), 
Calendar.getInstance(), 
Calendar.setTimeZone(), 
DateFormat.setTimeZone(), 
GregorianCalendar(), 
TimeZone.setDefault()

</DIV>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-30-SECT-24.4">Returned By:</A></h3>

<P CLASS=para>
Calendar.getTimeZone(), 
DateFormat.getTimeZone(), 
TimeZone.getDefault(), 
TimeZone.getTimeZone()

</DIV>

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch30_23.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch30_25.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>java.util.StringTokenizer (JDK 1.0)</td>
<td width=171 align=center valign=top><a href="index/idx_0.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>java.util.TooManyListenersException (JDK 1.1)</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
